#include <iostream>
#include <set>

using std::cout;
using std::endl;
using std::set;

template <typename Container>
void display(const Container &con)
{
    for(auto &elem :  con)
    {
        cout << elem << "  ";
    }
    cout << endl;
}

void test0()
{
    set<int> number = {1, 3, 5, 7, 8, 12, 10, 3, 3, 3};
    display(number);

    //删除连续的奇数
    for(auto it = number.begin(); it != number.end(); ++it)
    {
        if(1 == *it % 2)
        {
            /* number.erase(it++); */
            it = number.erase(it);
        }
    }
    display(number);
}

void test()
{
    set<int> number = {1, 3, 5, 7, 8, 12, 10, 3, 3, 3};
    display(number);

    //删除连续的奇数
    for(auto it = number.begin(); it != number.end();)
    {
        if(1 == *it % 2)
        {
            /* number.erase(it++); */
            it = number.erase(it);
        }
        else
        {
            ++it;
        }
    }
    display(number);
}
int main(int argc, char *argv[])
{
    test();
    return 0;
}

